home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / g / gnu_c / pmlsrc23.zoo / pmlsrc / clog.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-19  |  1.6 KB  |  80 lines

  1. /************************************************************************
  2.  *                                    *
  3.  *                N O T I C E                *
  4.  *                                    *
  5.  *            Copyright Abandoned, 1987, Fred Fish        *
  6.  *                                    *
  7.  *    This previously copyrighted work has been placed into the    *
  8.  *    public domain by the author (Fred Fish) and may be freely used    *
  9.  *    for any purpose, private or commercial.  I would appreciate    *
  10.  *    it, as a courtesy, if this notice is left in all copies and    *
  11.  *    derivative works.  Thank you, and enjoy...            *
  12.  *                                    *
  13.  *    The author makes no warranty of any kind with respect to this    *
  14.  *    product and explicitly disclaims any implied warranties of    *
  15.  *    merchantability or fitness for any particular purpose.        *
  16.  *                                    *
  17.  ************************************************************************
  18.  */
  19.  
  20.  
  21. /*
  22.  *  FUNCTION
  23.  *
  24.  *    clog   complex double precision natural logarithm
  25.  *
  26.  *  KEY WORDS
  27.  *
  28.  *    clog
  29.  *    complex functions
  30.  *    machine independent routines
  31.  *    math libraries
  32.  *
  33.  *  DESCRIPTION
  34.  *
  35.  *    Computes double precision complex natural logarithm of
  36.  *    a double precision complex argument.
  37.  *
  38.  *  USAGE
  39.  *
  40.  *    COMPLEX clog (z)
  41.  *    COMPLEX z;
  42.  *
  43.  *  REFERENCES
  44.  *
  45.  *    Fortran 77 user's guide, Digital Equipment Corp. pp B-13
  46.  *
  47.  *  PROGRAMMER
  48.  *
  49.  *    Fred Fish
  50.  *    Tempe, Az 85281
  51.  *    (602) 966-8871
  52.  *
  53.  *  INTERNALS
  54.  *
  55.  *    Computes complex natural logarithm of z = x + j y from:
  56.  *
  57.  *        1.    r_clog = log(cabs(z))
  58.  *
  59.  *        2.    i_clog = atan2(y,x)
  60.  *
  61.  *        3.    clog(z) = r_clog + j i_clog
  62.  *
  63.  */
  64.  
  65. #include <stdio.h>
  66. #include <math.h>
  67. #include "pml.h"
  68.  
  69. COMPLEX clog (z)
  70. COMPLEX z;
  71. {
  72.     double temp;
  73.  
  74.     temp = log (cabs (z));
  75.     z.imag = atan2 (z.imag, z.real);
  76.     z.real = temp;
  77.  
  78.     return (z);
  79. }
  80.